//
//  LWSearchView.swift
//  微博
//
//  Created by mac on 17/5/17.
//  Copyright © 2017年 mac. All rights reserved.
//

import UIKit

class LWSearchView: UIView {

    @IBOutlet weak var searchConstaints: NSLayoutConstraint!
    
    @IBOutlet weak var searchBtn: UIButton!
    

    @IBOutlet weak var searchTef: UITextField!
    
    
    @IBAction func EidBegin(_ sender: AnyObject) {
        
        
        searchConstaints.constant = searchBtn.frame.size.width
        
        UIView.animate(withDuration: 0.3) { 
            
            self.layoutIfNeeded()
            
        }
        
    }
    
    @IBAction func searchBtn(_ sender: AnyObject) {
        
        //辞去第一响应者
        searchTef.resignFirstResponder()
        
        searchConstaints.constant = 0
        
        UIView.animate(withDuration: 0.3) {
            
            self.layoutIfNeeded()
            
        }
        
        
    }
    //使用类方法创建XIB对象
    class func searcVciew()->LWSearchView{
        
        return UINib(nibName: "LWSearchView", bundle: nil).instantiate(withOwner: nil, options: nil).last! as! LWSearchView
        
        
    }
    
}
